﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace xUnitForms
{
    public class FormTester<T> : FormTester where T : System.Windows.Forms.Form
    {

        public T Form
        {
            get { return (T)this.Control; }
        }

        public FormTester(T Form)
            : base(Form)
        {
        }
    }

    public class FormTester : ControlTester<System.Windows.Forms.Form>
    {

        private DialogExpectation m_DialogTester;

        public FormTester(System.Windows.Forms.Form Form)
            : base(Form)
        {

            this.m_DialogTester = null;
        }

        public DialogExpectation BeginDialogExpectation(bool StrictExpectation)
        {
            // Create the dialog expectation instance for receiving the dialog message.
            this.m_DialogTester = new DialogExpectation(this.Control, StrictExpectation);
            // Show the hosting form is it's invisible in order to make the expectation be able to be run.
            if (this.Control.Visible == false)
            {
                this.Control.Show();
            }
            return this.m_DialogTester;
        }
    }
}
